<?#//v.3.0.0
#///////////////////////////////////////////////////////
#//  COPYRIGHT 2004 Phpauction.org ALL RIGHTS RESERVED//
#///////////////////////////////////////////////////////

require('../includes/config.inc.php');
include "loggedin.inc.php";

unset($ERR);
$prefix="../";
if(file_exists(realpath(phpa_uploaded()."settings.ini"))) {
	$INI_SETTINGS=parse_ini_file(realpath(phpa_uploaded()."settings.ini"));
	$SETTINGS=array_merge($SETTINGS,$INI_SETTINGS);
}
#//
if($_POST['action'] == "update" && phpa_securepost($_POST)) {
	#// Data check
	if(empty($_POST['thumb_show'])) {
		$ERR = $ERR_047;
	} else {
		#// Update database
		$query = "UPDATE PHPAUCTIONXL_settings SET
					  thumb_show=".$_POST['thumb_show'].",
					  thimbnailswidth=".$_POST['thimbnailswidth'].",
					  catthumbnailswidth=".$_POST['catthumbnailswidth'];
		$INI_SETTINGS['thumb_show'] = $_POST['thumb_show'];
		$INI_SETTINGS['thimbnailswidth'] = $_POST['thimbnailswidth'];
		$INI_SETTINGS['catthumbnailswidth'] = $_POST['catthumbnailswidth'];
		$initxt="";
		foreach($INI_SETTINGS as $k=>$v)
		$initxt.="$k=$v\r\n";
		$fp=fopen(realpath(phpa_uploaded()."settings.ini"),"w");
		fwrite($fp,$initxt);
		fclose($fp);
		$res = @mysql_query($query);
		if(!$res) {
			print "Error: $query<BR>".mysql_error();
			exit;
		} else {
			$SETTINGS['thumb_show'] = $_POST['thumb_show'];
			$SETTINGS['thimbnailswidth'] = $_POST['thimbnailswidth'];
			$SETTINGS['catthumbnailswidth'] = $_POST['catthumbnailswidth'];
			$ERR = $MGS_2__0046;
		}
	}
}

?>
<html>
<head>
<link rel='stylesheet' type='text/css' href='style.css' />
<link href="css/main.css" rel="stylesheet" type="text/css">
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
    <tr>
        <td>
            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="titulo">
                <tr>
                    <td class="icono"><img src="images/graph_icon2.gif" width="30" height="26"></td>
                    <td class="breadcrumbs"><p><span><?=$MSG_25_0009?></span>&nbsp;&gt;&gt;&nbsp;<?=$MGS_2__0042?></p></td>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
        <td align="center" valign="middle">&nbsp;</td>
    </tr>
    <tr>
        <td align="center" valign="middle">
            <table border=0 width=100% cellpadding=0 cellspacing=0 bgcolor="#FFFFFF">
                <tr>
                    <td align="center"> <br>
                        <form name=conf action=<?=$_SERVER['PHP_SELF']?> method=POST>
                            <table width="95%" border="0" cellspacing="0" cellpadding="0" class="base" style="border:1px solid #ccc;">
                                <tr>
                                    <td align=CENTER class=title><p><? print $MGS_2__0042; ?></p></td>
                                </tr>
                                <tr>
                                    <td>
                                        <table width=100% align="CENTER" cellpadding=0 cellspacing="0" bgcolor="#FFFFFF">
                                            <?
                                            if($ERR != "")
                                            {
   			      ?>
                                            <tr>
                                                <td colspan="2" class="error"><p><? print $ERR; ?> </p></td>
                                            </tr>
                                            <?
                                            }
           	      ?>
                                            <tr valign="TOP">
                                                <td height="31" colspan="2">
                                                   <p> <?=$MGS_2__0043;?> </p>                                             </td>
                                            </tr>
                                          
                                            <tr valign="TOP">
                                                <td height="31" class="lineV">
                                                    <p class="blue"><?=$MSG_25_0107;?>    </p>                                          </td>
                                                <td height="31">&nbsp; 
                                                    <input name=thumb_show type=text value="<?=$SETTINGS['thumb_show']?>" size=5 maxlength="10">
                                                    
                                                    <?=$MGS_2__0045;?>                                              </td>
                                            </tr>
                                            <tr valign="TOP">
                                                <td height="31"  class="lineV gris">
                                                    <p class="blue"> <?=$MSG_25_0108;?>   </p>                                           </td>
                                                <td height="31" class="gris">&nbsp; 
                                                    <input name=thimbnailswidth type=text value="<?=$SETTINGS['thimbnailswidth']?>" size=5 maxlength="10">
                                                    
                                                    <?=$MGS_2__0045;?>                                              </td>
                                            </tr>
                                            <tr valign="TOP">
                                                <td height="31" class="lineV">
                                                    <p class="blue"> <?=$MSG_25_0109;?>   </p>                                           </td>
                                                <td height="31" class="lineV">&nbsp; 
                                                    <input name=catthumbnailswidth type=text value="<?=$SETTINGS['catthumbnailswidth']?>" size=5 maxlength="10">
                                                    
                                                    <?=$MGS_2__0045;?>                                              </td>
                                            </tr>
                                          
                                            <tr>
                                                <td width=125 class="lineV">
                                                    <INPUT TYPE="hidden" NAME="action" VALUE="update" /> <INPUT TYPE="hidden" NAME="security" VALUE="<?php echo $_SESSION['security'];?>" />                                                </td>
                                                <td width="459">
                                                    <input type="submit" name="act" value="<? print $MSG_530; ?>" class="action">                                                </td>
                                            </tr>
                                            <tr>
                                                <td width=125></td>
                                                <td width="459"></td>
                                            </tr>
                                      </table>
                                    </td>
                                </tr>
                            </table>
                        </form>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
</table>
</body>
</html>
